//
//  FR_StudentRecordCell.m
//  FaceRecognition
//
//  Created by Sylar on 2016/12/6.
//  Copyright © 2016年 Sylar. All rights reserved.
//

#import "FR_StudentRecordCell.h"

@implementation FR_StudentRecordCell
{
    UILabel *nameLabel;
}


- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    if (self) {
        self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
        
        nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(15, 0, 150, 58)];
        [nameLabel setFont:[UIFont systemFontOfSize:18]];
        [nameLabel setTextColor:colorFromHex(@"#3b3b3b")];
        [self.contentView addSubview:nameLabel];
        
        UIView *lineView = [[UIView alloc]initWithFrame:CGRectMake(0, 57.5, SCREENWIDTH, 0.5)];
        [lineView setBackgroundColor:colorFromHex(@"#DEDEDE")];
        [self.contentView addSubview:lineView];
    }
    
    return self;
}

- (void)creatCell:(FR_StudentRecode_Model *)model {
    
    [nameLabel setText:model.username];
    
    for (UIImageView * img in self.contentView.subviews) {
        if (img.tag == 50) {
            [img removeFromSuperview];
        }
    }
    
    if (model.piclist.count > 0) {
        
        NSInteger count = model.piclist.count > 3?3:model.piclist.count;
        
        for (int i = 0; i < count; i ++) {
            
            NSDictionary *dic = [model.piclist objectAtIndex:i];
            
            UIImageView *img = [[UIImageView alloc]initWithFrame:CGRectMake(SCREENWIDTH - 155 + 50*i, 9, 40, 40)];
            img.tag = 50;
            [img sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",[dic objectForKey:@"fileurl"]]] placeholderImage:nil];
            
            [self.contentView addSubview:img];
        }
    }
    
}



- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}



@end
